package com.lbssoft.gpsbd.dao;

import com.lbssoft.gpsbd.model.GroupGeofence;
import org.apache.ibatis.annotations.*;

import java.util.List;
import java.util.Set;

@Mapper
public interface GroupGeofenceMapper {
	
	/**
	 * 分组绑定围栏
	 */
	@Insert("INSERT INTO lbs_group_geofence(groupId,geofenceId) VALUE(#{groupId},#{geofenceId})")
	void addGroupGeofence(GroupGeofence groupGeofence);

	/**
	 * 删除
     */
	@Delete("DELETE  FROM lbs_group_geofence WHERE geofenceid = #{geofenceId} AND groupId =  #{groupId}")
	void delete(GroupGeofence groupGeofence);
	
	/**
	 * 根据分组获取绑定的围栏ids
	 * @param groupId
	 * @return
     */
	@Select("SELECT geofenceId FROM lbs_group_geofence WHERE groupId =#{groupId}")
	Set<Long> getGeofenceIds(@Param("groupId") int groupId);
}
